package com.example.bookexchange;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;

public class OrderSuccessActivity extends AppCompatActivity {

    private TextView tvOrderSuccess ;
    private Button btnReturnHome, btnContinueShopping;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_order_success);

        // 获取布局中的控件
        tvOrderSuccess = findViewById(R.id.tvOrderSuccess);
        btnReturnHome = findViewById(R.id.btnReturnHome);
        btnContinueShopping = findViewById(R.id.btnContinueShopping);


        // 返回主页按钮点击事件
        btnReturnHome.setOnClickListener(v -> {
            // 跳转回首页
            Intent homeIntent = new Intent(OrderSuccessActivity.this, HomeActivity.class);
            startActivity(homeIntent);
            finish(); // 结束当前页面
        });

        // 继续购买按钮点击事件
        btnContinueShopping.setOnClickListener(v -> {
            // 跳转回商品购买页面
            Intent shoppingIntent = new Intent(OrderSuccessActivity.this, HomeActivity.class);
            startActivity(shoppingIntent);
            finish(); // 结束当前页面
        });
    }
}
